<template>
    <view class="pub_page pub_page_bg pub_header_padding pub_wallet">
        <pub-head :headerConfig="headerConfig"></pub-head>
        <div class="pub_page_scroll page_box">
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:1})">
                <div class="txt">旺票：</div>
                <div class="num">{{ userInfo.consumeTicket || 0 }}</div>
                <div class="btn pub_btn" @click.stop="$comFun.openWin('/pages/mine/send',{giveType:1})" v-if="configData && configData.isOpenWgive==1">转赠</div>
                <!-- <div class="btn pub_btn" @click.stop="$comFun.openWin('/pages/mine/withdraw',{openType:1})">寄售</div> -->
            </div>
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:2})">
                <div class="txt">幸运值：</div>
                <div class="num">{{ userInfo.increment || 0 }}</div>
                <div class="btn pub_btn" @click.stop="$comFun.openWin('/pages/mine/send',{giveType:3})" v-if="configData && configData.isOpenIgive==1">转赠</div>
            </div>
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:3})">
                <div class="txt">兑换券：</div>
                <div class="num">{{ userInfo.exchangeTicket || 0 }}</div>
            </div>
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:4})">
                <div class="txt">幸运券数量：</div>
                <div class="num">{{ userInfo.vipCard || 0 }}</div>
            </div>
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:6})">
                <div class="txt">承兑汇票：</div>
                <div class="num">{{ userInfo.acceptanceBill || 0 }}</div>
                <div class="btn pub_btn" @click.stop="$comFun.openWin('/pages/mine/send',{giveType:2})" v-if="configData && configData.isOpenCgive==1">转赠</div>
                <div class="btn pub_btn" @click.stop="$comFun.openWin('/pages/mine/switch',{giveType:1})">兑换</div>
            </div>
            <div class="lis_div" @click="$comFun.openWin('/pages/mine/log',{openType:5})">
                <div class="txt">股份：</div>
                <div class="num">{{ userInfo.stock || 0 }}</div>
            </div>
        </div>
    </view>
</template>

<script>
export default {
    data() {
        return {
            headerConfig: {
                title: '钱包管理',//标题栏内容
                left_type: 3,
                title_color: '#000',
                left_content: 'dark',
                header_color: '#fff'
            },

            userInfo: '',
            configData: '',
        };
    },
    onLoad() {
        this.getConfig()
    },
    onShow() {
        this.getInfo();
    },
    methods: {
        async getInfo() {
            if (this.userInfo == '') {
                this.$comFun.openLoading();
            }
            const res = await this.$request.get('user/userInfo', {});
            if (this.userInfo == '') {
                this.$comFun.closeLoading();
            }
            // console.log(res);
            if (res.code == 200) {
                this.userInfo = res.result;
            }
        },
        async getConfig() {
            this.configData = await getApp().getConfigList();
            // console.log(configRes);
        }
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/mine.scss";
</style>
